package com.zretc.notice.utils;

import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * 功能：
 * 作者：111
 * 日期：2024/7/3 16:25
 */
public class SensitiveWordManager {
    private Set<String> sensitiveWords;

    public SensitiveWordManager() {
        loadSensitiveWords();
    }

    private void loadSensitiveWords() {
        try {
            // 从文件中读取敏感词列表
            List<String> words = Files.readAllLines(Paths.get("D:/word.txt"));//敏感词文件路径
            sensitiveWords = new HashSet<>(words);
        } catch (Exception e) {
            e.printStackTrace();
            sensitiveWords = new HashSet<>();
        }
    }

    public Set<String> getSensitiveWords() {
        return sensitiveWords;
    }
}